import marked from 'marked'
import highlight from 'highlight.js'
import 'highlight.js/styles/github.css'

const renderer = new marked.Renderer();

marked.setOptions({
  renderer: renderer,
  // 代码高亮
  highlight: function (code) {
    return highlight.highlightAuto(code).value;
  },
  // 加上hljs类名，确保有背景
  langPrefix: 'hljs language-',
  pedantic: false,
  gfm: true,
  tables: true,
  breaks: false,
  sanitize: false,
  smartLists: true,
  smartypants: false,
  xhtml: false
})

export default marked